From: Matthieu Gallien Date: Thu, 15 May 2025 10:30:25 +0000 (+0200) Subject: fix(delete): fix move to trash when parent folder is read-only X-Git-Tag: archive/raspbian/3.16.7-1_deb13u1+rpi1^2~13^2~1^2~37^2~2 X-Git-Url: https://dgit.raspbian.org/%22http://www.example.com/cgi/%22/%22http:/www.example.com/cgi/%22?a=commitdiff_plain;h=3d5dce67a4648e1cd85c08f5a89bc3e34601a077;p=nextcloud-desktop.git fix(delete): fix move to trash when parent folder is read-only Signed-off-by: Matthieu Gallien --- diff --git a/src/libsync/propagatorjobs.cpp b/src/libsync/propagatorjobs.cpp index c2b929d83..272fe40b6 100644 --- a/src/libsync/propagatorjobs.cpp +++ b/src/libsync/propagatorjobs.cpp @@ -110,6 +110,9 @@ void PropagateLocalRemove::start() if (_moveToTrash && propagator()->syncOptions()._vfs->mode() != OCC::Vfs::WindowsCfApi) { const auto fileInfo = QFileInfo{filename}; if (FileSystem::fileExists(filename, fileInfo)) { + const auto parentFolderPath = fileInfo.dir().absolutePath(); + const auto parentPermissionsHandler = FileSystem::FilePermissionsRestore{parentFolderPath, FileSystem::FolderPermissions::ReadWrite}; + if (!FileSystem::moveToTrash(filename, &removeError)) { qCWarning(lcPropagateLocalRemove()) << "move to trash failed" << filename << removeError; done(SyncFileItem::NormalError, tr("Temporary error when removing local item removed from server."), ErrorCategory::GenericError);